com.rscja.team.qcom.deviceapi

## Class BluetoothReader_qcom

- java.lang.Object
- - com.rscja.team.qcom.deviceapi.BluetoothReader_qcom

- All Implemented Interfaces:
    IBluetoothReader, IReader
  Direct Known Subclasses:
    RFIDWithUHFBLE_qcom

      public class BluetoothReader_qcom
      extends java.lang.Object
      implements IBluetoothReader

  蓝牙读写器操作类：
  Bluetoot reader operation 第一步：调用`init(Context context)` 函数初始化蓝牙相关服务，退出应用程序需要调用`free()`是否蓝牙相关资源
  First step: Call `init(Context context)`to initiate BT service, call `free()` to exit application. 第二步：调用`connect(java.lang.String, com.rscja.deviceapi.interfaces.ConnectionStatusCallback<java.lang.Object>)`连接蓝牙，在此之前你可以调用`startScanBTDevices(com.rscja.deviceapi.interfaces.ScanBTCallback)`搜索附件的符合要求的蓝牙设备
  Second step: call `connect(java.lang.String, com.rscja.deviceapi.interfaces.ConnectionStatusCallback<java.lang.Object>)` to connect BT, user could call `startScanBTDevices(com.rscja.deviceapi.interfaces.ScanBTCallback)` to search BT device nearby before connecting.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `isBarcodeDataContainCodeID`
    `static int` | `isBarcodeDataContainSSIID`

    - ### Fields inherited from interface com.rscja.deviceapi.interfaces.IBluetoothReader

      `VERSION_BT_FIRMWARE, VERSION_BT_HARDWARE, VERSION_BT_SOFTWARE`

    - ### Fields inherited from interface com.rscja.deviceapi.interfaces.IReader

      `UPDATE_STM32`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `blinkOfLed(int duration, int interval, int count)` led 闪烁
    `boolean` | `closeLed()` 关闭led
    `void` | `connect(java.lang.String address)` 连接蓝牙(Connect Bluetooth)
    `void` | `connect(java.lang.String address, ConnectionStatusCallback<java.lang.Object> btStatusCallback)` 连接蓝牙(Connect Bluetooth)
    `void` | `disconnect()` 断开蓝牙(Disconnect Bluetooth)
    `boolean` | `free()` 释放蓝牙相关的资源(free Bluetooth resources)
    `int` | `getBarcodeDataCodeIdContainType()`
    `int` | `getBarcodeTypeInSSIID()`
    `int` | `getBattery()` 获取电池电量 Acquire battery capacity
    `int` | `getBeep()`
    `java.lang.String` | `getBleHardwareVersion()`
    `java.lang.String` | `getBluetoothDeviceAddress()`
    `java.util.HashMap<java.lang.String,java.lang.String>` | `getBluetoothVersion()` 获取蓝牙版本号(acquire Bluetooth version)
    `ConnectionStatus` | `getConnectStatus()` 获取蓝牙连接状态(Acquire Bluetooth connection status)
    `static BluetoothReader_qcom` | `getInstance()` Get BluetoothReader
    `int` | `getKeyMode()`
    `byte[]` | `getParameter(byte[] ssiParameter)`
    `java.lang.String` | `getSTM32Version()` 获取stm32版本号(Acquire stm32 version )
    `int` | `getTurnkey()`
    `boolean` | `init(android.content.Context context)` 初始化蓝牙相关的服务(Intialize Bluetooth services)
    `boolean` | `openLed()` 打开led
    `java.lang.String` | `scanBarcode()` 扫描条码 Scan barcode
    `byte[]` | `scanBarcodeToBytes()` 扫描条码 Scan barcode
    `boolean` | `sendData(byte[] sendData)` 发送指令(send data)
    `boolean` | `sendDataNotSyn(byte[] sendData)`
    `boolean` | `setBarcodeTypeInSSIID(boolean isContainBarcodeType)`
    `boolean` | `setBeep(boolean isOpen)` 设置蜂鸣器开关 Setup buzzer ON/OFF
    `void` | `setConnectionStatusCallback(ConnectionStatusCallback<java.lang.Object> btStatusCallback)` 设置蓝牙连接状态的回调(Setup Bluetooth connection status call back)
    `boolean` | `setEnableKeyMode(boolean enable)`
    `boolean` | `setEnableTurnkey(boolean enable)`
    `void` | `setKeyEventCallback(KeyEventCallback KeyEventCallback)` 设置扫描按键回调 Setup SCAN button call back
    `void` | `setOnDataChangeListener(BluetoothReader.OnDataChangeListener onDataChangeListener)` 设置接收蓝牙原始数据的回调函数 setup call back function for receiving BT initial data.
    `boolean` | `setParameter(byte[] ssiParameter, byte[] value)`
    `boolean` | `setRemoteBluetoothName(java.lang.String name)` 修改蓝牙名称(Change Bluetooth device Name)
    `BarcodeResult` | `startScanBarcode()`
    `boolean` | `startScanBarcodeInBlinkMode(BluetoothReader.DecodeCallback decodeCallback)`
    `boolean` | `startScanBarcodeInTriggleMode(BluetoothReader.DecodeCallback decodeCallback)`
    `void` | `startScanBTDevices(ScanBTCallback scanBTCallback)` 扫描蓝牙设备(scanning Bluetooth devices)
    `boolean` | `stopScanBarcode()`
    `void` | `stopScanBTDevices()` 停止扫描蓝牙设备(Stop scanning Bluetooth devices)
    `boolean` | `triggerBeep(int durationTime)` 触发蜂鸣器(Trigger the buzzer)

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### isBarcodeDataContainCodeID

          public static int isBarcodeDataContainCodeID

    - #### isBarcodeDataContainSSIID

          public static int isBarcodeDataContainSSIID

  - ### Method Detail

    - #### getInstance

          public static BluetoothReader_qcom getInstance()

      Get BluetoothReader
      Returns:
        return BluetoothReader

    - #### init

          public boolean init(android.content.Context context)

      Description copied from interface: `IBluetoothReader`
      初始化蓝牙相关的服务(Intialize Bluetooth services)
      Specified by:
        `init` in interface `IBluetoothReader`
      Parameters:
        `context` - context
      Returns:
        true:成功(success) false:失败(failure)

    - #### free

          public boolean free()

      Description copied from interface: `IBluetoothReader`
      释放蓝牙相关的资源(free Bluetooth resources)
      Specified by:
        `free` in interface `IBluetoothReader`
      Returns:
        true:成功(success) false:失败(failure)

    - #### startScanBTDevices

          public void startScanBTDevices(ScanBTCallback scanBTCallback)

      Description copied from interface: `IBluetoothReader`
      扫描蓝牙设备(scanning Bluetooth devices)
      Specified by:
        `startScanBTDevices` in interface `IBluetoothReader`
      Parameters:
        `scanBTCallback` - 扫描结果回调(scanning result call back)

    - #### stopScanBTDevices

          public void stopScanBTDevices()

      Description copied from interface: `IBluetoothReader`
      停止扫描蓝牙设备(Stop scanning Bluetooth devices)
      Specified by:
        `stopScanBTDevices` in interface `IBluetoothReader`

    - #### setConnectionStatusCallback

          public void setConnectionStatusCallback(ConnectionStatusCallback<java.lang.Object> btStatusCallback)

      Description copied from interface: `IBluetoothReader`
      设置蓝牙连接状态的回调(Setup Bluetooth connection status call back)
      Specified by:
        `setConnectionStatusCallback` in interface `IBluetoothReader`
      Parameters:
        `btStatusCallback` - 蓝牙连接状态回调接口(Bluetooth connection status call back)

    - #### connect

          public void connect(java.lang.String address,
                              ConnectionStatusCallback<java.lang.Object> btStatusCallback)

      Description copied from interface: `IBluetoothReader`
      连接蓝牙(Connect Bluetooth)
      Specified by:
        `connect` in interface `IBluetoothReader`
      Parameters:
        `address` - 蓝牙地址(Bluetooth address )
        `btStatusCallback` - 蓝牙连接状态回调接口(Bluetooth connection status call back)

    - #### setKeyEventCallback

          public void setKeyEventCallback(KeyEventCallback KeyEventCallback)

      Description copied from interface: `IReader`
      设置扫描按键回调
      Setup SCAN button call back
      Specified by:
        `setKeyEventCallback` in interface `IReader`
      Parameters:
        `KeyEventCallback` - 按键回调接口(Keyboard call back)

    - #### openLed

          public boolean openLed()

      打开led
      Specified by:
        `openLed` in interface `IReader`
      Returns:
        true:success false:false

    - #### closeLed

          public boolean closeLed()

      关闭led
      Specified by:
        `closeLed` in interface `IReader`
      Returns:
        true:success false:false

    - #### blinkOfLed

          public boolean blinkOfLed(int duration,
                                    int interval,
                                    int count)

      led 闪烁
      Specified by:
        `blinkOfLed` in interface `IReader`
      Parameters:
        `duration` - 持续发光时间 范围为1-255，单位为100ms( Duration of luminescence , value:1-255 , unit:100ms )
        `interval` - 间隔时间 范围为1-255，单位为100ms (interval time, value:1-255, unit:100ms)
        `count` - 闪烁次数 1-255 (count, value:1-255)
      Returns:
        true:success false:false

    - #### disconnect

          public void disconnect()

      Description copied from interface: `IBluetoothReader`
      断开蓝牙(Disconnect Bluetooth)
      Specified by:
        `disconnect` in interface `IBluetoothReader`

    - #### getConnectStatus

          public ConnectionStatus getConnectStatus()

      Description copied from interface: `IBluetoothReader`
      获取蓝牙连接状态(Acquire Bluetooth connection status)
      Specified by:
        `getConnectStatus` in interface `IBluetoothReader`
      Returns:
        返回蓝牙连接状态(Return Bluetooth connection status)

    - #### getBattery

          public int getBattery()

      Description copied from interface: `IReader`
      获取电池电量
      Acquire battery capacity
      Specified by:
        `getBattery` in interface `IReader`
      Returns:
        返回电量，-1表示获取电量失败(return battery capacity, -1 means acquire failure.)

    - #### setBeep

          public boolean setBeep(boolean isOpen)

      Description copied from interface: `IReader`
      设置蜂鸣器开关
      Setup buzzer ON/OFF
      Specified by:
        `setBeep` in interface `IReader`
      Parameters:
        `isOpen` - true:打开蜂鸣器(ON)， false:关闭蜂鸣器(OFF)
      Returns:
        true:成功(success) false:失败(failure)

    - #### getBeep

          public int getBeep()

      Specified by:
        `getBeep` in interface `IBluetoothReader`

    - #### triggerBeep

          public boolean triggerBeep(int durationTime)

      触发蜂鸣器(Trigger the buzzer)
      Specified by:
        `triggerBeep` in interface `IReader`
      Parameters:
        `durationTime` - 持续时间, 范围1-255，单位为100ms (Duration, range 1-255, Unit:100ms)
      Returns:
        true success,false false

    - #### scanBarcode

          public java.lang.String scanBarcode()

      Description copied from interface: `IReader`
      扫描条码
      Scan barcode
      Specified by:
        `scanBarcode` in interface `IReader`
      Returns:
        返回条码字符串数据(return barcode string data)

    - #### scanBarcodeToBytes

          public byte[] scanBarcodeToBytes()

      Description copied from interface: `IReader`
      扫描条码
      Scan barcode
      Specified by:
        `scanBarcodeToBytes` in interface `IReader`
      Returns:
        返回条码的原始byte数据(return initial byte data of barcode)

    - #### startScanBarcodeInBlinkMode

          public boolean startScanBarcodeInBlinkMode(BluetoothReader.DecodeCallback decodeCallback)

    - #### startScanBarcodeInTriggleMode

          public boolean startScanBarcodeInTriggleMode(BluetoothReader.DecodeCallback decodeCallback)

    - #### stopScanBarcode

          public boolean stopScanBarcode()

      Specified by:
        `stopScanBarcode` in interface `IBluetoothReader`
      Returns:

    - #### setBarcodeTypeInSSIID

          public boolean setBarcodeTypeInSSIID(boolean isContainBarcodeType)

      Specified by:
        `setBarcodeTypeInSSIID` in interface `IReader`

    - #### getBarcodeTypeInSSIID

          public int getBarcodeTypeInSSIID()

      Specified by:
        `getBarcodeTypeInSSIID` in interface `IReader`

    - #### getBarcodeDataCodeIdContainType

          public int getBarcodeDataCodeIdContainType()

    - #### startScanBarcode

          public BarcodeResult startScanBarcode()

      Specified by:
        `startScanBarcode` in interface `IReader`

    - #### setParameter

          public boolean setParameter(byte[] ssiParameter,
                                      byte[] value)

      Specified by:
        `setParameter` in interface `IReader`

    - #### getParameter

          public byte[] getParameter(byte[] ssiParameter)

      Specified by:
        `getParameter` in interface `IReader`

    - #### setOnDataChangeListener

          public void setOnDataChangeListener(BluetoothReader.OnDataChangeListener onDataChangeListener)

      设置接收蓝牙原始数据的回调函数
      setup call back function for receiving BT initial data.
      Specified by:
        `setOnDataChangeListener` in interface `IBluetoothReader`
      Parameters:
        `onDataChangeListener` - OnDataChangeListener

    - #### sendData

          public boolean sendData(byte[] sendData)

      Description copied from interface: `IBluetoothReader`
      发送指令(send data)
      Specified by:
        `sendData` in interface `IBluetoothReader`
      Returns:
        true:成功(success) false:失败(failure)

    - #### sendDataNotSyn

          public boolean sendDataNotSyn(byte[] sendData)

    - #### setRemoteBluetoothName

          public boolean setRemoteBluetoothName(java.lang.String name)

      Description copied from interface: `IBluetoothReader`
      修改蓝牙名称(Change Bluetooth device Name)
      Specified by:
        `setRemoteBluetoothName` in interface `IBluetoothReader`
      Parameters:
        `name` - 新的蓝牙名称(New Bluetooth name)
      Returns:
        true:成功(success) false:失败(failure)

    - #### getSTM32Version

          public java.lang.String getSTM32Version()

      Description copied from interface: `IReader`
      获取stm32版本号(Acquire stm32 version )
      Specified by:
        `getSTM32Version` in interface `IReader`
      Returns:
        返回stm32版本 (return stm32 version)

    - #### getBluetoothVersion

          public java.util.HashMap<java.lang.String,java.lang.String> getBluetoothVersion()

      Description copied from interface: `IBluetoothReader`
      获取蓝牙版本号(acquire Bluetooth version)
      Specified by:
        `getBluetoothVersion` in interface `IBluetoothReader`
      Returns:
        key:`IBluetoothReader.VERSION_BT_FIRMWARE` 表示固件版本(Firmware Version), key:`IBluetoothReader.VERSION_BT_HARDWARE` 表示硬件版本(Hardware version) ， key:`IBluetoothReader.VERSION_BT_SOFTWARE` 表示软件版本(software version)

    - #### getBleHardwareVersion

          public java.lang.String getBleHardwareVersion()

      Specified by:
        `getBleHardwareVersion` in interface `IBluetoothReader`

    - #### connect

          public void connect(java.lang.String address)

      Description copied from interface: `IBluetoothReader`
      连接蓝牙(Connect Bluetooth)
      Specified by:
        `connect` in interface `IBluetoothReader`
      Parameters:
        `address` - 蓝牙地址(Bluetooth address)

    - #### getBluetoothDeviceAddress

          public java.lang.String getBluetoothDeviceAddress()

    - #### getKeyMode

          public int getKeyMode()

    - #### setEnableKeyMode

          public boolean setEnableKeyMode(boolean enable)

    - #### getTurnkey

          public int getTurnkey()

    - #### setEnableTurnkey

          public boolean setEnableTurnkey(boolean enable)